package com.kyp.thrift;

import java.util.List;

import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

public class HelloClient {
	public static void main(String[] args) throws Exception{
		//if(args.length < 4){
		//	System.out.println("host, port, name, age");
		//	System.exit(0);
		//}
		//String host = args[0];
		//int port = Integer.parseInt(args[1]);
		//int timeout = 10 * 1000;
		
		//final TSocket socket = new TSocket("172.27.115.42", 9898);
		TTransport transport = new TSocket("172.27.145.69", 9898);
		//socket.setTimeout(timeout);
		
		//final TTransport transport = new TFramedTransport(socket);
		final TProtocol protocol = new TBinaryProtocol(transport);
		final KYPService.Client client = new KYPService.Client(protocol);

		transport.open();
		List<data> result = client.ListAllData("wow~ success!");
		System.out.println("Received [" + result.get(0).key + ", " + result.get(0).value + "]");
		
		transport.close();
		
	}
}
